home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 5 / chrpro3.zip / CFBUDGMO.CMD < prev    next >
OS/2 REXX Batch file  |  1991-01-21  |  7KB  |  227 lines

  1. * Program CFBUDGMO - View/edit the church year-to-date budget
  2. Select primary
  3. ? 'Now reading the Department Account summaries.'
  4. Store D+':ACCOUNT'+DF to MFILE
  5. USE &MFILE INDEX &MFILE
  6. Release LEVEL2,MSEL,validd1,XX,DF
  7. Store ' ' to NSEL
  8. Do while !(NSEL)<>'Q'
  9. Store '0' to NNN
  10. Store ' ' to NSEL
  11. GOTO TOP
  12. Store $(account,1,2) to inaccnt
  13. If inaccnt<>'D1'
  14.   ? 'Department 1 lead code =',inaccnt,'which is invalid. (Must be "D1")'
  15.   Accept 'The ACCOUNT file must be rebuilt. Press <RETURN> to exit.' to XX
  16.   RETURN
  17. endif
  18. Store '0' to N
  19. Store 0.00 to acctytd
  20. Store 0.00 to acctp
  21. Store 0.00 to acctact
  22. Store 0.00 to acctrcv
  23. Store 0.00 to acctpr
  24. Store 0.00 to accnt1
  25. Store 0.00 to accnt2
  26. Store 0.00 to accnt3
  27. Store 0.00 to accnt4
  28. Store 0.00 to accnt5
  29. Store 0.00 to accnt6
  30. Store 0.00 to accnt7
  31. Store 0.00 to accnt8
  32. Store 0.00 to accnt9
  33. Store 0.00 to acctbala
  34. Do while .not. EOF .and. N<>'9' .and. account='D'
  35.   Store str(val(N)+1,1) to N
  36.   If $(account,2,1)<>N .and. NNN='0'
  37.     Store N to NNN
  38.   endif
  39.   Store val(paidytd)+acctytd to acctytd
  40.   Store prevowed to accnt&N
  41.   Store newpaid to acctpr&N
  42.   Store acctpr+newpaid to acctpr
  43.   Store newowed to acctp&N
  44.   Store acctp+newowed to acctp
  45.   Store $(account,2,23)+paidytd to accname&N
  46.   Store $(account,1,2) to inaccnt
  47.   Store val(newpdate) to acctrcv&N
  48.   Store acctrcv+acctrcv&N to acctrcv
  49.   Do while account=inaccnt .and. .not. EOF
  50.     SKIP
  51.   enddo
  52. enddo
  53. GOTO TOP
  54. Store N to NN
  55. Do while !(NSEL)<>'D' .and. !(NSEL)<>'Q' .and. !(NSEL)<>'A'
  56. erase
  57. @ 0,1 say MFILE
  58. @ 0,62 say curdate
  59. @ 1,16 say CHNAME+' Monthly Budget - by Department'
  60. If !(NSEL)='B'
  61.   @ 2,35 say '*******'
  62. endif
  63. @ 3,23 say         '   Year-    current  current  current   current  projectd'
  64. @ 4,5  say 'Department          to-date    month  received   month     month'
  65. @ 4,73 say 'BALANCE'
  66. @ 5,23 say         '   actual    budget  balance   actual   projectd  ON-HAND'
  67. Store '0' to N
  68. Set colon off
  69. Do while N<>NN
  70.   Store val(N)+1 to I
  71.   Store str(I,1) to N
  72.   @ I+6,0 say accname&N
  73.   If !(NSEL)='B'
  74.     @ I+6,32 get accnt&N
  75.   else
  76.     @ I+6,32 say accnt&N
  77.   endif
  78.   @ I+6,42 say str(acctrcv&N,9,2)
  79.   @ I+6,51 say str(acctp&N,9,2)
  80.   @ I+6,60 say acctpr&N
  81.   Store acctrcv&N-acctp&N-acctpr&N to acctbal
  82.   @ I+6,70 say acctbal
  83.   Store acctbal+acctbala to acctbala
  84. enddo
  85. @ I+7,23 say  '---------  --------  -------  -------  --------  --------'
  86. READ
  87. Store accnt1+accnt2+accnt3+accnt4+accnt5+accnt6+accnt7+accnt8+accnt9 to accnt
  88. @ I+8,22 say acctytd
  89. @ I+8,32 say accnt
  90. @ I+8,42 say str(acctrcv,9,2)
  91. @ I+8,51 say str(acctp,9,2)
  92. @ I+8,60 say acctpr
  93. @ I+8,70 say acctbala
  94. ?
  95. ?      'Select: [B]udget editing      [A]dd a department     [R]eport'
  96. Accept '        [E]dit a department   [D]elete a department  [Q]uit ' to NSEL
  97. Store $(nsel,1,1) to xx
  98. Do while @(XX,'BbAaDdEeQqRr')=0
  99.   Accept 'Invalid entry. Please enter again ' to nsel
  100.   Store $(nsel,1,1) to xx
  101. enddo
  102. Do case
  103.   CASE !(NSEL)='B'
  104.     Store '0' to N
  105.   CASE !(NSEL)='E'
  106.     Store '0' to N
  107.     Do while N<>'9'
  108.       Store str(val(N)+1,1) to N
  109.       Release acctp&n,acctpr&n,acctrcv&N,accname&n,acctytd&N
  110.     enddo
  111.     Release acctp,acctpr,acctact,acctrcv,acctprb,acctbal,inaccnt,accnt,NNN
  112.     Do CFBUDGDE.CMD
  113.   CASE !(NSEL)='A'
  114.     If NN='9'
  115.       ? 'Illegal ADD - 9 maximum Departments allowed.'
  116.     else
  117.       If NNN<>'0'
  118.         Store NNN to NN
  119.       else
  120.         Store str(val(NN)+1,1) to NN
  121.       endif
  122.       Clear gets
  123.       Set colon on
  124.       Store '                           ' to N
  125.       @ I+13,8 say 'Enter DEPARTMENT NAME ' get N
  126.       READ
  127.       Set colon off
  128.       Append blank
  129.       Replace account with 'D'+nn+'  '+N
  130.       Replace paidytd with '     0.00'
  131.       Replace newpdate with '    0.00'
  132.     endif
  133.   CASE !(NSEL)='D'
  134.     ?
  135.     Accept '        Enter DEPARTMENT number to be deleted ' to N
  136.     If !(N)='1'
  137.       ? 'Invalid Department.  Can't delete "Utilities"'
  138.     else
  139.       Store 'D'+N  to N
  140.       Find &N
  141.       If #=0
  142.         ?
  143.         ? '        Department number not found. '
  144.       else
  145.         If val(paidytd)<>0 .or. newpaid<>0 .or. newpdate<>'    0.00'
  146.           ? '        Invalid DELETE request. This Department has paid amounts.'
  147.         else
  148.           Replace account with 'ED  '+$(account,5,30)
  149.           Replace newpdate with date()
  150.           ? '        Department',account,'is deleted.'
  151.           Do while ACCOUNT=N
  152.             DELETE
  153.             SKIP
  154.           enddo
  155.         endif
  156.       endif
  157.     endif
  158.   CASE !(NSEL)='R'
  159.     Set format to print
  160.     GOTO TOP
  161. @ 0,2  say MFILE
  162. @ 0,60 day curdate
  163. @ 1,15 say CHNAME+' Monthly Budget - by Department'
  164. @ 3,23 say         '   Year-    current  current  current   current  projectd'
  165. @ 4,5  say 'Department          to-date    month  received   month     month'
  166. @ 4,73 say 'BALANCE'
  167. @ 5,23 say         '   actual    budget  balance   actual   projectd  ON-HAND'
  168. Store '0' to N
  169. Set colon off
  170. Do while N<>NN
  171.   Store val(N)+1 to I
  172.   Store str(I,1) to N
  173.   @ I+6,0 say accname&N
  174.   @ I+6,32 say accnt&N
  175.   @ I+6,42 say str(acctrcv&N,9,2)
  176.   @ I+6,51 say str(acctp&N,9,2)
  177.   @ I+6,60 say acctpr&N
  178.   Store acctrcv&N-acctp&N-acctpr&N to acctbal
  179.   @ I+6,70 say acctbal
  180.   Store acctbal+acctbala to acctbala
  181. enddo
  182. @ I+7,23 say  '---------  --------  -------  -------  --------  --------'
  183. @ I+8,22 say acctytd
  184. @ I+8,32 say accnt
  185. @ I+8,42 say str(acctrcv,9,2)
  186. @ I+8,51 say str(acctp,9,2)
  187. @ I+8,60 say acctpr
  188. @ I+8,70 say acctbala
  189. EJECT
  190. Set format to screen
  191.   CASE !(NSEL)='Q'
  192.     GOTO TOP
  193.     Store $(account,1,2) to inaccnt
  194.     If inaccnt<>'D1'
  195.       ? 'Department 1 lead code =',inaccnt,'which is invalid ("D1").'
  196.       Accept 'The ACCOUNT file must be fixed or re-built. Press <retn> ' to xx
  197.     else
  198.     Store '0' to N
  199.     Do while N<>NN .and. .not. EOF
  200.       Store str(val(N)+1,1) to N
  201.       Replace prevowed with accnt&N
  202.       Store $(account,1,2) to inaccnt
  203.       Do while account=inaccnt
  204.         SKIP
  205.       enddo
  206.     enddo
  207.     endif
  208.   ENDCASE
  209. ENDDO
  210. ENDDO
  211. Release inval1,accnt1,accnt2,accnt3,accnt4,accnt5,accnt6,accnt7,accnt8,accnt9
  212. ENDDO
  213. Set colon on
  214. USE
  215. Select primary
  216. Use
  217. Release acct,NN,NNN,acctytd,accnt,inaccnt,acctp,acctact,acctrcv,acctpr,acctbala
  218. Store '0' to N
  219. Do while N<>'9'
  220.   Store str(val(N)+1,1) to N
  221.   Release ACCNAME&N,acctrcv&N,acctytd&N,acctpr&N,acctp&N,accnt&N
  222. enddo
  223. Store T to LEVEL2
  224. Store T to validd1
  225. Store '1' to msel
  226. RETURN
  227.